﻿// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.TokenFactoryBase
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 8E14765A-6610-409A-BA36-099A0642905D
// Assembly location: E:\git\ALLIDA\windll\infocard.exe

namespace Microsoft.InfoCards
{
  internal abstract class TokenFactoryBase : ITokenFactory
  {
    private bool m_aborted;

    public bool IsAborted
    {
      get
      {
        return this.m_aborted;
      }
    }

    public TokenDescriptor CreateToken(
      InfoCard infoCard,
      TokenFactoryCredential credential,
      InfoCardPolicy policy,
      bool discloseOptional)
    {
      TokenCreationParameter parameters = (TokenCreationParameter) null;
      if (credential != null && -1 != credential.ParameterIndex)
        parameters = infoCard.CreationParameters[credential.ParameterIndex];
      return this.ProduceToken(infoCard, parameters, credential, policy, discloseOptional);
    }

    public void Abort()
    {
      this.OnAbort();
      this.m_aborted = true;
    }

    protected abstract TokenDescriptor ProduceToken(
      InfoCard card,
      TokenCreationParameter parameters,
      TokenFactoryCredential credential,
      InfoCardPolicy policy,
      bool discloseOptional);

    protected virtual void OnAbort()
    {
    }
  }
}
